(function (doc, win) {
  const designWidth = 1920 // 设计图宽度
  const minFitWidth = 1260 // 最小适配宽度，小于该值则产生横向滚动条
  const rem = 100 // 1rem和px之间的换算值
  const docEle = doc.documentElement
  const resizeEvent = 'orientationchange' in win ? 'orientationchange' : 'resize'
  const eventHandle = function () {
    let clientWidth = docEle.clientWidth
    if (!clientWidth) return
    if (clientWidth >= minFitWidth) {
      docEle.style.fontSize = rem * (clientWidth / designWidth) + 'px'
    }
  }
  if (!doc.addEventListener) return
  win.addEventListener(resizeEvent, eventHandle, false)
  doc.addEventListener('DOMContentLoaded', eventHandle, false)
})(document, window)